/**
 * bind:funcname = "页面对应接受函数"
 * this.triggerEvent('funcname', options);这种方式进行值的传递
 */
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */

  /**
   * 组件的初始数据
   */
  data: {
    logidconfig: {
      name: '账号',
      proholder: '请输入强智账号'
    },
    logpwdconfig: {
      name: '密码',
      proholder: '默认身份证后6位'
    },
    id: '',
    pwd: ''
  },
  /**
   * 声明周期
   */
  lifetimes: {
    async created() {
      var that = this;
      // console.log(this.properties.avatar)
      let edudata = await wx.getStorageSync('educookie') || 0
      if (edudata != 0) {
        //console.log(edudata)
        that.setData({
          id: edudata.xh,
          pwd: edudata.pwd
        })
      }
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    GetId(e) {
      // console.log(e)
      this.setData({
        id: e.detail.value
      })
    },
    GetPwd(e) {

      this.setData({
        pwd: e.detail.value
      })
    },
    tourist() {
      //游客登录
      this.triggerEvent('listener', {
        action: 'login',
        type: 'tourist'
      });
    },
    tobind() {
      console.log('绑定登录')
      this.triggerEvent('listener', {
        action: 'login',
        type: 'bind',
        xh: this.data.id,
        pwd: this.data.pwd
      });

    }
  }
})